package pl.maciejziarko.mshare.utils;

import org.slf4j.helpers.MessageFormatter;

/**
 * @author Maciej Ziarko
 */
public class FormattedApplicationException extends Exception {

    protected static String format(String message, Object arg1) {
        return MessageFormatter.format(message, arg1).getMessage();
    }

    protected static String format(String message, Object arg1, Object arg2) {
        return MessageFormatter.format(message, arg1, arg2).getMessage();
    }

    public FormattedApplicationException() {
        super("Application exception.");
    }

    public FormattedApplicationException(String message, Object arg1) {
        super(format(message, arg1));
    }

    public FormattedApplicationException(String message, Object arg1, Object arg2) {
        super(format(message, arg1, arg2));
    }
}
